<?php

    if (! defined('SIMPLE_TEST')) {
        define('SIMPLE_TEST', '../simpletest/');
    }
    require_once(SIMPLE_TEST . 'autorun.php');

    include '../Include/Include.php';


class ProveedorEliminarLogicaTest extends UnitTestCase {

    public function ProveedorEliminarLogicaTest() {
        $this->UnitTestCase();
    }

    public function testhacer() {
        $DBConn = null;
        $conexion = new conexion();
        $DBConn = $conexion->setConnect();
        $DBConn->consulta( "INSERT INTO proveedor VALUES (-1, -1,
                            'Prueba Nombre Empresa', 'Prueba Direccion',
                            'Prueba Nombre', 'Prueba Apellido', '0444-444-44-44',
                            'PruebaEmail@gmail.com', 1);" );

         $DBConn->consulta( "SELECT * FROM proveedor
                           WHERE PRV_ID = -1" );

        $fila = $DBConn->extraer_registro();
        $this->assertEqual( $fila['PRV_STATUS'], 1 );

        $proveedorEliminarLogicaTest = new ProveedorEliminarLogica( -1 );
        $respuesta = $proveedorEliminarLogicaTest->hacer();
        $this->assertTrue($respuesta);

        $DBConn->consulta( "SELECT * FROM proveedor
                           WHERE PRV_ID = -1" );

        $fila2 = $DBConn->extraer_registro();
        $this->assertEqual( $fila2['PRV_STATUS'], 0 );

        $DBConn->consulta("DELETE FROM proveedor
                          WHERE PRV_ID = -1" );

    }
}

?>
